home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1989 July & August / rerun-1989-07-08.d64 / a-z scramble (.txt) next >
Commodore BASIC  |  2022-09-20  |  2KB  |  72 lines

  1. 1 rem the game of scramble
  2. 2 rem by brian melcher
  3. 5 poke53280,0:poke53281,0:print"[147]     [156][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
  4. 10 print"     [192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
  5. 15 print"[158]                  [221]        "
  6. 20 print"      [192][192]    [221]  [221]     [221]   [192][192]"
  7. 25 print"         [192][192]  [192]   [167] [165]  [192]    "
  8. 30 print"     [192][192]     [221]  [221] [167] [165] [221]   [192][192]"
  9. 35 print"            [146][181]  [221] [167] [180]         "
  10. 40 printspc(10)"the game of scramble"
  11. 45 print"     [192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
  12. 50 print"     [156][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
  13. 55 diml$(64),s(5):printspc(9)"[159]press space when ready"
  14. 60 geta$:ifa$<>" "then60
  15. 65 print"[147][156]    [192][192][192][192][192][192][192][192]":print"[159]    scramble":print"[156]    [192][192][192][192][192][192][192][192][158]"
  16. 70 print"    how many players (1-5)"
  17. 75 geta$:ifa$<"1"ora$>"5"then75
  18. 80 p=val(a$):print"    how many chances (1-5)"
  19. 85 geta$:ifa$<"1"ora$>"5"then85
  20. 90 c=val(a$):print"    enter grid size (2-8)"
  21. 95 geta$:ifa$<"2"ora$>"8"then95
  22. 100 g=val(a$):form=1to5:s(m)=999999:next:b=1:ifg>4thenb=2:ifg=8thenb=3
  23. 105 forh=1toc:fori=1top:j=0
  24. 110 form=1tog*g:l$(m)=chr$(int(rnd(0)*26)+65):next:z=0:gosub340:ifz=1then110
  25. 115 print"[147]"spc(14);:form=1tog:print"[158]  "chr$(64+m);:next:print" "
  26. 120 form=1tog:printspc(14)"[158] [146][151]";:forn=1tog:print"  [170]";:next:print
  27. 125 printspc(14)"[158]"chr$(48+m);:forn=1tog:print"[146][151]  [170]";:next:print
  28. 130 printspc(14)"[158] [146][151]";:forn=1tog:print"[175][175][186]";:next:ifm<gthenprint
  29. 135 next:print"[159] player"i"up":print" trial"h:print" [156]best times:"
  30. 140 form=1top:print"  player"m"[157]:":print"   "s(m):next:print""
  31. 145 gosub325:print" [158]enter move"
  32. 150 print"            ";:e=1:u$="":v$="":w$="":x$=""
  33. 155 geta$:ifa$=""then155
  34. 160 ifa$=chr$(20)then150
  35. 165 ifa$="\"thenj=999999:goto275
  36. 170 ife=2then215
  37. 175 ifa$<"a"ora$>chr$(64+g)then190
  38. 180 ifu$<>""then155
  39. 185 u$=a$:goto205
  40. 190 ifa$<"1"ora$>chr$(48+g)then155
  41. 195 ifw$<>""then155
  42. 200 w$=a$
  43. 205 ifu$<>""andw$<>""thene=2
  44. 210 goto250
  45. 215 ifa$<"a"ora$>chr$(64+g)then230
  46. 220 ifv$<>""then155
  47. 225 v$=a$:goto245
  48. 230 ifa$<"1"ora$>chr$(48+g)then155
  49. 235 ifx$<>""then155
  50. 240 x$=a$
  51. 245 ifv$<>""andx$<>""thene=3
  52. 250 printa$;:ife<3then155
  53. 255 ifu$=v$andw$=x$then150
  54. 260 u=asc(u$):v=asc(v$):w=asc(w$):x=asc(x$):ifabs(u-v)>borabs(w-x)>bthen150
  55. 265 q=(u-64)+(w-49)*g:r=(v-64)+(x-49)*g:j=j+1:t$=l$(q):l$(q)=l$(r):l$(r)=t$
  56. 270 gosub325:z=0:gosub340:ifz=0then145
  57. 275 ifj<s(i)thens(i)=j
  58. 280 print"[147][159]  this match is now over.":print"[156]  player:"i,j"[156]moves."
  59. 285 print"  press space"
  60. 290 geta$:ifa$<>" "then290
  61. 295 next:next:print"[147] [159]the game is now over.":print" here are the final ";
  62. 300 print"scores:":form=1top:print"   [156]player"m"[157][156]:"s(m):next
  63. 305 print" would you like to play again (y/n)?"
  64. 310 geta$:ifa$="y"then65
  65. 315 ifa$<>"n"then310
  66. 320 print"[147][158]":end
  67. 325 print"[129]":form=1tog:printtab(14);:forn=1tog:print""l$((m-1)*g+n);
  68. 330 next:ifm<gthenprint""
  69. 335 next:return
  70. 340 forn=1tog*g-1:ifl$(n)>l$(n+1)thenreturn
  71. 345 next:z=1:return
  72.